FLAGS := -g -std=c99 -O3 -Wall --verbose
LIB_PATH := -L . -L /usr/local/lib
LIBS := -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil -lm -lpthread
INCLUDE_PATH := -I . -I /usr/local/include
CC := gcc

all : transcoder

CFILES:=$(shell find . -name "*.c")
OBJS:=$(CFILES:%.c=%.o)

all:
#$(CC) -o transcoder $(OBJS) $(LIB_PATH)  $(LIBS)
	gcc -g -std=c99 -c -O3 -Wall -I . -I /usr/local/include ./transcoder_core.c ./output_utils.c ./list.c ./transcoder.c ./encoding.c ./decoding.c gop.c ./core_binding.c
	gcc -o transcoder list.o transcoder_core.o transcoder.o output_utils.o encoding.o decoding.o gop.o core_binding.o -L /usr/local/lib -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil -lm -lpthread

# $(OBJS):$(CFILES)
# 	$(CC) $(FLAGS) $(INCLUDE_PATH) $(CFILES)

# transcoder: transcoder.o libtranscoder_core 
# 	$(CC) $(FLAGS) $(LIB_PATH) transcoder.o -o transcoder $(LIBS)
# 
# libtranscoder_core: transcoder_core.o list.o
# 	ar rcs libtranscoder_core.a transcoder_core.o list.o
# 
# list.o: list.c
# 	$(CC) $(FLAGS) $(INCLUDE_PATH) -c list.c -o list.o $(LIBS)
# 
# transcoder_core.o: transcoder_core.c 
# 	$(CC) $(FLAGS) $(INCLUDE_PATH) -c transcoder_core.c -o transcoder_core.o $(LIBS) 
# 
# output_utils.o: output_utils.c 
# 	$(CC) $(FLAGS) $(INCLUDE_PATH) -c output_utils.c -o output_utils.o $(LIBS) 
# 
# transcoder.o: transcoder.c
# 	$(CC) $(FLAGS)  $(INCLUDE_PATH) -c transcoder.c -o transcoder.o $(LIBS) 
 
clean:
	rm -f *.o libtranscoder_core.a transcoder

